/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2020 All Rights Reserved.
 */
package com.suxiaoxiao.Leetcode.simple;

/**
 * 回文
 *
 * @author zhaorongzhang
 * @version Palindrome.java, v 0.1 2020/1/3 10:07 上午 zhaorongzhang Exp $$
 */
public class Palindrome {

    public boolean isPalindrome(int x) {
        String palindromeString = String.valueOf(x);
        int intermediateNumber = palindromeString.length()/2;
        int subNumber = palindromeString.length() % 2 == 0 ? intermediateNumber : intermediateNumber + 1;
        String palindromeStringHead = palindromeString.substring(0, intermediateNumber);
        String palindromeStringEnd = palindromeString.substring(subNumber);
        if (palindromeStringHead.equals(palindromeStringEnd)) {
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        System.out.println(3 % 2);
        System.out.println(4 % 2);
    }

}